<?php


namespace app\portal\model;


use think\Model;

class ScoreModel extends Model
{
    /**
     * 模型名称
     * @var string
     */
    protected $name = 'score';

    public function getReviewList($uid) {
        $field = 'w.id as w_id,w.title as w_title,u.user_login,u.mobile,c.title as c_title,c.review_start,c.review_end,cc.name as cate_name,s.*';
        $scoresQuery = $this->alias('s');
        $scoresQuery->join('works w','s.work_id = w.id');
        $scoresQuery->join('contest c', 'c.id = s.contest_id');
        $scoresQuery->join('user u', 's.review_id = u.id');
        $scoresQuery->join('contest_category cc','w.contest_category = cc.id');

        $score = $scoresQuery->field($field)
            ->where('s.review_id',$uid)
//            ->order("w.score = 0 ASC")
            ->order('w.update_time', 'DESC')
            ->paginate(10);
        return $score;
    }
}